import service from '@/api/index.js';

export const getRoleListByPage = async (params) => {
  try {
    const res = await service.get('jestic-account-admin/v1/pt/account-admin/system/role/listByPage', { params });
    return res;
  } catch (error) {
    throw error;
  }
};

export const updateRoleStatus = async (data) => {
  try {
    const res = await service.post('jestic-account-admin/v1/pt/account-admin/system/role/changeRoleStatus', data);
    return res;
  } catch (error) {
    throw error;
  }
};

export const selectRoleList = async (params) => {
  try {
    const res = await service.get('jestic-account-admin/v1/pt/account-admin/system/role/list', { params });
    return res;
  } catch (error) {
    throw error;
  }
};

export const saveOrUpdateRole = async (data) => {
  try {
    const res = await service.post('jestic-account-admin/v1/pt/account-admin/system/role/saveOrUpdateRole', data);
    return res;
  } catch (error) {
    throw error;
  }
};

export const searchRoleInfoById = async (params) => {
  try {
    const res = await service.get('jestic-account-admin/v1/pt/account-admin/system/role/searchRoleInfoById', { params });
    return res;
  } catch (error) {
    throw error;
  }
};

export const deleteRoleInfo = async (data) => {
  try {
    const res = await service.post('jestic-account-admin/v1/pt/account-admin/system/role/deleteRoleInfo', data);
    return res;
  } catch (error) {
    throw error;
  }
};